package com.ulic.customerManApplication.membermodule.bo;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.ulic.customerManApplication.mailmodule.bo.MailRecord;
import com.ulic.customerManApplication.messagemodule.bo.MessageRecord;
import com.ulic.customerManApplication.usermodule.bo.User;

@Entity
@Table(name="T_GYW_MEMBER")
@SequenceGenerator(name="member_seq",sequenceName="S_GYW_MEMBER_ID")
public class Member implements Serializable{

	/**
	 * 会员信息
	 */
	private static final long serialVersionUID = 1L;
	private int id;//编号
	private String memberName;//会员姓名
	private String gender;//性别
	private String idCard;//身份证号码
	private String birthday;//生日
	private String cellPhone;//手机
	private String email;//电子邮件
	private String memberType;//会员类型
	private String carType;//车辆类型
	private String carBrand;//车辆品牌
	private Integer donateStuNum;//捐助学生人数
	private String donateRecord;//捐助记录
	private String reproduceIntroduce;//转介绍记录
	private String forumPosting;//论坛回帖记录
	private Date createDate;//创建时间
	private String remark;//备注
	
	private String subCompany;//所属机构
	
	private String subCity;//所属中支
	
	private String subComName;//分公司名称
	
	private String subCityName;//中支名称
	
	private User user;//创建者

	private Set<MessageRecord> messageRecords = new HashSet<MessageRecord>();//会员收到的短信
	
	private Set<MailRecord> mailRecordsForAddr = new HashSet<MailRecord>();//会员收到的邮件
	
	private Set<MailRecord> mailRecordForCopy = new HashSet<MailRecord>();//会员被抄送的邮件
	
	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="member_seq")
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getMemberName() {
		return memberName;
	}
	public void setMemberName(String memberName) {
		this.memberName = memberName;
	}
	public String getGender() {
		return gender;
	}
	public void setGender(String gender) {
		this.gender = gender;
	}
	public String getIdCard() {
		return idCard;
	}
	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}
	public String getBirthday() {
		return birthday;
	}
	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}
	public String getCellPhone() {
		return cellPhone;
	}
	public void setCellPhone(String cellPhone) {
		this.cellPhone = cellPhone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getMemberType() {
		return memberType;
	}
	public void setMemberType(String memberType) {
		this.memberType = memberType;
	}
	public String getCarType() {
		return carType;
	}
	public void setCarType(String carType) {
		this.carType = carType;
	}
	public String getCarBrand() {
		return carBrand;
	}
	public void setCarBrand(String carBrand) {
		this.carBrand = carBrand;
	}
	public Integer getDonateStuNum() {
		return donateStuNum;
	}
	public void setDonateStuNum(Integer donateStuNum) {
		this.donateStuNum = donateStuNum;
	}
	public String getDonateRecord() {
		return donateRecord;
	}
	public void setDonateRecord(String donateRecord) {
		this.donateRecord = donateRecord;
	}
	public String getReproduceIntroduce() {
		return reproduceIntroduce;
	}
	public void setReproduceIntroduce(String reproduceIntroduce) {
		this.reproduceIntroduce = reproduceIntroduce;
	}
	public String getForumPosting() {
		return forumPosting;
	}
	public void setForumPosting(String forumPosting) {
		this.forumPosting = forumPosting;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	@ManyToMany(cascade = CascadeType.REFRESH, mappedBy = "receiver")
	public Set<MessageRecord> getMessageRecords() {
		return messageRecords;
	}
	public void setMessageRecords(Set<MessageRecord> messageRecords) {
		this.messageRecords = messageRecords;
	}
	@ManyToMany(cascade = CascadeType.REFRESH, mappedBy = "addressees")   
	public Set<MailRecord> getMailRecordsForAddr() {
		return mailRecordsForAddr;
	}
	public void setMailRecordsForAddr(Set<MailRecord> mailRecordsForAddr) {
		this.mailRecordsForAddr = mailRecordsForAddr;
	}
	@ManyToMany(cascade = CascadeType.REFRESH, mappedBy = "copiesTo")   
	public Set<MailRecord> getMailRecordForCopy() {
		return mailRecordForCopy;
	}
	public void setMailRecordForCopy(Set<MailRecord> mailRecordForCopy) {
		this.mailRecordForCopy = mailRecordForCopy;
	}
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY, optional = false)   
    @JoinColumn(name="UM_USER_ID")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public String getSubCompany() {
		return subCompany;
	}
	public void setSubCompany(String subCompany) {
		this.subCompany = subCompany;
	}
	public String getSubCity() {
		return subCity;
	}
	public void setSubCity(String subCity) {
		this.subCity = subCity;
	}
	public String getSubComName() {
		return subComName;
	}
	public void setSubComName(String subComName) {
		this.subComName = subComName;
	}
	public String getSubCityName() {
		return subCityName;
	}
	public void setSubCityName(String subCityName) {
		this.subCityName = subCityName;
	}
}
